package com.tengfei.blogsystem.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @version v1.0
 * @author} feige
 * @date 2021-10-16-16:08
 * @description
 */
public class TextUtils {
    // 空值判断
    public static boolean isEmpty(String text) {
        return text == null || text.length() == 0;
    }

    // 邮箱地址正则匹配
    public static boolean isEmailAddress(String email) {
        String regEx = "^([_a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
        Pattern compile = Pattern.compile(regEx);
        Matcher matcher = compile.matcher(email);
        return matcher.matches();
    }
}
